<script lang="ts" setup name="TestA">
import { ref, onMounted, onActivated, onDeactivated } from 'vue'
import mitt from '@/utils/mitt';

const count = ref(0);
// console.log(a);
onMounted(() => {
  console.log('A组件onMounted')
})
onActivated(() => {
  console.log('onActivated ===> 相当于 vue2.x 中 activated')
});
onDeactivated(() => {
  console.log('onDeactivated ===> 相当于 vue2.x 中 deactivated')
});

const mittVal = ref<string>('')
const emitEvent = () => {
  mitt.emit('updateTitle', mittVal.value);
}
</script>

<template>
  <p>TestA组件</p>
  <span>{{ count }}</span>
  <button @click="count++">+</button>
  <div>
    <input type="text" v-model="mittVal">
    <button @click="emitEvent">mitt发送</button>
  </div>
</template>
